android: Enable building ashmem and binder as modules
authorBen Hutchings <ben@decadent.org.uk>
Fri, 22 Jun 2018 16:27:00 +0000 (17:27 +0100)
committerSalvatore Bonaccorso <carnil@debian.org>
Sat, 18 Aug 2018 12:02:58 +0000 (13:02 +0100)
We want to enable use of the Android ashmem and binder drivers to
support Anbox, but they should not be built-in as that would waste
resources and increase security attack surface on systems that don't
need them.

- Add a MODULE_LICENSE declaration to ashmem
- Change the Makefiles to build each driver as an object with the
  "_linux" suffix (which is what Anbox expects)
- Change config symbol types to tristate

Gbp-Pq: Topic debian
Gbp-Pq: Name android-enable-building-ashmem-and-binder-as-modules.patch

drivers/android/Kconfig
drivers/android/Makefile
drivers/android/binder_alloc.c
drivers/staging/android/Kconfig
drivers/staging/android/Makefile
drivers/staging/android/ashmem.c

index 7dce3795b8874ba83d29215e5c70daf7e4a3cee9..a07594dbc29a7b813b746ce20f34b79fe03b6da5 100644 (file)
@@ -9,7 +9,7 @@ config ANDROID
 if ANDROID
 
 config ANDROID_BINDER_IPC
-       bool "Android Binder IPC Driver"
+       tristate "Android Binder IPC Driver"
        depends on MMU
        default n
        ---help---
index a01254c43ee3f714020aff487314f32ec0b2bbde..e42257997ba8c4f2f69a51b0ea19c07d285e1f1f 100644 (file)
@@ -1,4 +1,5 @@
 ccflags-y += -I$(src)                  # needed for trace events
 
-obj-$(CONFIG_ANDROID_BINDER_IPC)       += binder.o binder_alloc.o
-obj-$(CONFIG_ANDROID_BINDER_IPC_SELFTEST) += binder_alloc_selftest.o
+obj-$(CONFIG_ANDROID_BINDER_IPC)       += binder_linux.o
+binder_linux-y := binder.o binder_alloc.o
+binder_linux-$(CONFIG_ANDROID_BINDER_IPC_SELFTEST) += binder_alloc_selftest.o
index 5a426c877dfb21696dad149c86a447e216909542..3850dab493d45bcd90738a596c1d491d17f0f1ae 100644 (file)
@@ -42,7 +42,7 @@ enum {
 };
 static uint32_t binder_alloc_debug_mask;
 
-module_param_named(debug_mask, binder_alloc_debug_mask,
+module_param_named(alloc_debug_mask, binder_alloc_debug_mask,
                   uint, 0644);
 
 #define binder_alloc_debug(mask, x...) \
index 71a50b99caff160b9f5603ac4229f87c84cacb09..e988dab69e8fb12972bb94c6e6b3e064077511f4 100644 (file)
@@ -3,7 +3,7 @@ menu "Android"
 if ANDROID
 
 config ASHMEM
-       bool "Enable the Anonymous Shared Memory Subsystem"
+       tristate "Enable the Anonymous Shared Memory Subsystem"
        default n
        depends on SHMEM
        ---help---
index 7cf1564a49a5eec86acf2c6f09a9196940beef25..3ef90fdfc8f7b1b0f15ba488f5102825e5a73e40 100644 (file)
@@ -2,4 +2,5 @@ ccflags-y += -I$(src)                   # needed for trace events
 
 obj-y                                  += ion/
 
-obj-$(CONFIG_ASHMEM)                   += ashmem.o
+obj-$(CONFIG_ASHMEM)                   += ashmem_linux.o
+ashmem_linux-y += ashmem.o
index a1a0025b59e0e020b7e86cce894723254f325725..85697ecc06d5959c3c208724d457d737c595fb9a 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/bitops.h>
 #include <linux/mutex.h>
 #include <linux/shmem_fs.h>
+#include <linux/module.h>
 #include "ashmem.h"
 
 #define ASHMEM_NAME_PREFIX "dev/ashmem/"
@@ -895,3 +896,5 @@ out:
        return ret;
 }
 device_initcall(ashmem_init);
+
+MODULE_LICENSE("GPL v2");